package com.tanglongan.designPattern.dp18_observer.demo01;

import java.util.Observable;
import java.util.Observer;

public class Teacher implements Observer {
    private final String name;

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        Csdn csdn = (Csdn) o;
        Question question = (Question) arg;
        System.out.println("=====================");
        System.out.println(name + "老师，您好!\n" + "您收到一个来自" + csdn.getName() + "的提问，希望您解答。问题内容如下：\n" + question.getContent() + "\n提问者：" + question.getUserName());
    }
}
